import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home'
Vue.use(VueRouter)
// 才能 往 Vue 原型中 灌入（$router 和 $route）
const routes = [{
  path: '/',
  redirect: '/home'
},
{
  path: '/home',
  name: 'home',
  component: Home
},
{
  path: '/news',
  name: 'news',
  component: () => import('../views/News')
},
{
  path: '/about',
  name: 'about',
  component: () => import('../views/About')
}
]

const router = new VueRouter({
  routes
})

export default router
